package com.zcm.modules.cxf.entity;

import java.util.List;

public class BabaResponse {

    private Integer ret;
    private Long count = 0L;
    private String message;
    private Object data;
    private Integer pageNo;
    private Integer pageSize;

    public static BabaResponse ok(Object data) {
        if(data instanceof List){
            return new BabaResponse(0, (long) ((List) data).size(),"",data);
        }
        return new BabaResponse(0,1L,"",data);
    }

    public static BabaResponse ok() {
        return new BabaResponse(0,1L,"",null);
    }

    public static BabaResponse error(int errorNo, String error) {
        return new BabaResponse(errorNo,0L,error,null);
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }
    public BabaResponse(Integer ret, Long count, String message, Object data) {
        this.ret = ret;
        this.count = count;
        this.message = message;
        this.data = data;
    }

    public BabaResponse() {
    }


    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Integer getRet() {
        return ret;
    }

    public void setRet(Integer ret) {
        this.ret = ret;
    }
}
